﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MainSite.Master" AutoEventWireup="true" CodeBehind="CascadingKPI.aspx.cs" Inherits="BSCMFF.Web.Pages.BSC_Setup.CascadingKPI" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

<table>
<tr>
    <td valign="top">
        <telerik:RadGrid ID="RadGrid1" runat="server"  CellSpacing="0" 
            DataSourceID="EntityDataSourceKPIs" Width="300px"
                    GridLines="None" ShowGroupPanel="false" 
            
            onitemcommand="RadGrid1_ItemCommand" >
                <%--<ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True">
                </ClientSettings>--%>
        <MasterTableView AutoGenerateColumns="False" DataKeyNames="KPI_ID"  GroupLoadMode="Client"
                    DataSourceID="EntityDataSourceKPIs">
            <GroupByExpressions>
                <telerik:GridGroupByExpression>
                    <SelectFields>
                        <telerik:GridGroupByField FieldAlias="Perspective" FieldName="Perspective.Name" 
                            HeaderValueSeparator=" : "></telerik:GridGroupByField>
                    </SelectFields>
                    <GroupByFields>
                        <telerik:GridGroupByField FieldName="Perspective_FK" ></telerik:GridGroupByField>
                    </GroupByFields>
                </telerik:GridGroupByExpression>
            </GroupByExpressions>
        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
        <HeaderStyle Width="20px"></HeaderStyle>
        </RowIndicatorColumn>

        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
        <HeaderStyle Width="20px"></HeaderStyle>
        </ExpandCollapseColumn>

            <Columns>
                <telerik:GridBoundColumn DataField="KPI_ID" DataType="System.Int32" Visible="false"
                    FilterControlAltText="Filter KPI_ID column" HeaderText="KPI_ID" ReadOnly="True" 
                    SortExpression="KPI_ID" UniqueName="KPI_ID">
                </telerik:GridBoundColumn>
               <%-- <telerik:GridBoundColumn DataField="Type_FK" DataType="System.Int32" 
                    FilterControlAltText="Filter Type_FK column" HeaderText="Type_FK" 
                    SortExpression="Type_FK" UniqueName="Type_FK">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Solution_FK" DataType="System.Int32" 
                    FilterControlAltText="Filter Solution_FK column" HeaderText="Solution_FK" 
                    SortExpression="Solution_FK" UniqueName="Solution_FK">
                </telerik:GridBoundColumn>--%>
                <telerik:GridBoundColumn DataField="Name" 
                    FilterControlAltText="Filter Name column" HeaderText="KPI" 
                    SortExpression="Name" UniqueName="Name">
                </telerik:GridBoundColumn>
                <%--<telerik:GridBoundColumn DataField="Description" 
                    FilterControlAltText="Filter Description column" HeaderText="Description" 
                    SortExpression="Description" UniqueName="Description">
                </telerik:GridBoundColumn>--%>
               <%--  <telerik:GridBoundColumn DataField="Measure" 
                    FilterControlAltText="Filter Measure column" HeaderText="Measure" 
                    SortExpression="Measure" UniqueName="Measure">
                </telerik:GridBoundColumn>
               <telerik:GridBoundColumn DataField="Optimization" 
                    FilterControlAltText="Filter Optimization column" HeaderText="Optimization" 
                    SortExpression="Optimization" UniqueName="Optimization">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Target_Description" 
                    FilterControlAltText="Filter Target_Description column" 
                    HeaderText="Target_Description" SortExpression="Target_Description" 
                    UniqueName="Target_Description">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Priority" DataType="System.Int32" 
                    FilterControlAltText="Filter Priority column" HeaderText="Priority" 
                    SortExpression="Priority" UniqueName="Priority">
                </telerik:GridBoundColumn>--%>
                <telerik:GridBoundColumn DataField="Perspective.Name" DataType="System.String"  Visible="false"
                    FilterControlAltText="Filter Perspective_FK column" HeaderText="Perspective" 
                    SortExpression="Perspective.Name" UniqueName="Perspective.Name">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Perspective_FK" DataType="System.Int32" 
                     HeaderText="Perspective_FK" 
                    SortExpression="Perspective_FK" UniqueName="Perspective_FK" Visible="false">
                </telerik:GridBoundColumn>
                <telerik:GridButtonColumn CommandName="Select" Text="Select" ></telerik:GridButtonColumn>
            </Columns>

        <EditFormSettings>
        <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
        </EditFormSettings>
        </MasterTableView>
        <ClientSettings ReorderColumnsOnClient="false" AllowDragToGroup="false" AllowColumnsReorder="false">
                        <Selecting AllowRowSelect="false"></Selecting>
                        <Resizing AllowRowResize="false" AllowColumnResize="false" EnableRealTimeResize="false"
                            ResizeGridOnColumnResize="False"></Resizing>
                    </ClientSettings>
                    <GroupingSettings ShowUnGroupButton="true" />
        <FilterMenu EnableImageSprites="False"></FilterMenu>

        <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
        </telerik:RadGrid>
    </td>
        <td valign="top">
        <asp:Panel ID="PanelCascade" runat="server" Visible="false">
                <bsc:DetailsKPI ID="dkpi" runat="server" Visible="false" />
   
      <%--
            
               <br />--%>
        
                <asp:Label ID="Label" runat="server" Text="Existing Personal KPIs for selected KPI" ></asp:Label>
                    <telerik:RadGrid ID="RadGridPKPIs" runat="server" CellSpacing="0" 
                         GridLines="None" 
                        >
                        <MasterTableView AutoGenerateColumns="False" 
                             DataKeyNames="Personal_KPI_ID">
                        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

                        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                        <HeaderStyle Width="20px"></HeaderStyle>
                        </RowIndicatorColumn>

                        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                        <HeaderStyle Width="20px"></HeaderStyle>
                        </ExpandCollapseColumn>

                            <Columns>
                                <%--<telerik:GridBoundColumn DataField="Personal_KPI_ID" DataType="System.Int32" 
                                    FilterControlAltText="Filter Personal_KPI_ID column" 
                                    HeaderText="Personal_KPI_ID" ReadOnly="True" SortExpression="Personal_KPI_ID" 
                                    UniqueName="Personal_KPI_ID">
                                </telerik:GridBoundColumn>--%>
                                <telerik:GridBoundColumn DataField="Personal_KPI_ID" Visible="false"
                                    FilterControlAltText="Filter Personal_KPI_ID column" 
                                    HeaderText="Personal_KPI_ID" ReadOnly="True" 
                                    SortExpression="Personal_KPI_ID" UniqueName="Personal_KPI_ID" 
                                    DataType="System.Int32">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Name" 
                                    FilterControlAltText="Filter Name column" HeaderText="Name" 
                                    SortExpression="Name" UniqueName="Name">
                                </telerik:GridBoundColumn>
                                <%--<telerik:GridBoundColumn DataField="User.Fullname" DataType="System.String" 
                                    FilterControlAltText="Filter Employee column" HeaderText="Employee" 
                                    ReadOnly="True" SortExpression="User.Fullname" UniqueName="User_FK">
                                </telerik:GridBoundColumn>--%>
                                <telerik:GridBoundColumn DataField="Description" 
                                    FilterControlAltText="Filter Description column" HeaderText="Description" 
                                    SortExpression="Description" UniqueName="Description">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Weight" DataType="System.Int32" 
                                    FilterControlAltText="Filter Weight column" HeaderText="Weight" 
                                    SortExpression="Weight" UniqueName="Weight">
                                </telerik:GridBoundColumn>
                                <%--<telerik:GridBoundColumn DataField="Score" DataType="System.Int32" 
                                    FilterControlAltText="Filter Score column" HeaderText="Score" 
                                    SortExpression="Score" UniqueName="Score">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="VerbalEvaluation" 
                                    FilterControlAltText="Filter VerbalEvaluation column" 
                                    HeaderText="VerbalEvaluation" SortExpression="VerbalEvaluation" 
                                    UniqueName="VerbalEvaluation">
                                </telerik:GridBoundColumn>--%>
                                <telerik:GridBoundColumn DataField="User.Fullname" DataType="System.String" 
                                    FilterControlAltText="Filter Employee column" HeaderText="Employee" 
                                    SortExpression="User.Fullname" UniqueName="User.Fullname">
                                </telerik:GridBoundColumn>
                                <%--<telerik:GridBoundColumn DataField="KPI_FK" DataType="System.Int32" 
                                    FilterControlAltText="Filter KPI_FK column" HeaderText="KPI_FK" 
                                    SortExpression="KPI_FK" UniqueName="KPI_FK">
                                </telerik:GridBoundColumn>--%>
                            </Columns>

                        <EditFormSettings>
                        <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
                        </EditFormSettings>
                        </MasterTableView>

                        <FilterMenu EnableImageSprites="False"></FilterMenu>

                        <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
                    </telerik:RadGrid>
       

               <bsc:EmployeeGroupSelection ID="EGS" runat="server" ActionButtonName="Cascade KPIs" 
                OnActionButtonClicked="RadButtonCreateLink_Click" />
               <%--<telerik:RadButton ID="RadButtonCreateLink" runat="server" Text="Add Personal KPI for selected Employees" 
                    Width="300px" onclick="RadButtonCreateLink_Click"></telerik:RadButton>--%>
            </asp:Panel>
         </td>
    </tr>
   <%--<asp:Button ID="bb" runat="server" Text="Postback" />--%>
</table>

    
    <asp:EntityDataSource ID="EntityDataSourceKPIs" runat="server" 
        ConnectionString="name=BSCEntities" DefaultContainerName="BSCEntities" 
        EnableDelete="True" EnableFlattening="False" EnableInsert="True" 
        EnableUpdate="True" EntitySetName="KPIs" Include="Perspective">
    </asp:EntityDataSource>


<asp:entitydatasource ID="EntityDataSourcePerspectives" runat="server" ConnectionString="name=BSCEntities" 
        DefaultContainerName="BSCEntities" EnableFlattening="False" 
        EntitySetName="Perspectives" Select="it.[Perspective_ID], it.[Name]"></asp:entitydatasource>

<asp:EntityDataSource ID="EntityDataSourcePKPIs" runat="server" Include="User"
        ConnectionString="name=BSCEntities" DefaultContainerName="BSCEntities" 
        EnableFlattening="False" EntitySetName="Personal_KPI" 
        >
</asp:EntityDataSource>
<%--
Where="KPI_FK == @SelectedKPI">
    <WhereParameters>
        <asp:ControlParameter ControlID="RadGrid1" Type="Int32" DefaultValue="0" 
            Name="SelectedKPI" PropertyName="SelectedValue" />
    </WhereParameters>--%>

</asp:Content>

